/*
  学习目标：使用redux创建store数据仓库
  步骤：
     1. 下包/ 导入 createStore
     2. 调用函数createStore(reducer函数)

     语法:
     
     1. 创建store:  createStore(function (state = 初始值) {return state})
     2. 获取state: store.getState()
*/

import { legacy_createStore as createStore } from 'redux';

// reducer函数的形参, 用来设置state的初始值
const store = createStore(function (state = { count: 0, msg: 'hello' }) {
  // 💥 reducer函数一定要有返回值
  return state;
});

const state = store.getState();

console.log('state  ----->  ', state);
